/*  
 * Copyright (C) 2011 Marta Spodymek
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  
 */
package org.prometheuscode.web.feedback.file;

import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

/**
 * Class holds data about file including the file stream.
 * 
 * @author marta
 */
public class FileInfo {

    public final static String CONTENT_TYPE_INFO = "contentType";

    public final static String POSTED_NAME_INFO = "postedName";

    public final static String FILE_NAME_INFO = "fileName";

    private Map<String, String> info = new HashMap<String, String>();

    private InputStream fileInput;

    public FileInfo() {
    }

    /**
     * Get info with given name.
     * 
     * @param infoName
     * @return
     */
    public String getInfo(String infoName) {
	return this.info.get(infoName);
    }

    /**
     * Add info with given name.
     * 
     * @param infoName
     * @param infoValue
     * @return
     */
    public String addInfo(String infoName, String infoValue) {
	return this.info.put(infoName, infoValue);
    }

    /**
     * Get all info.
     * 
     * @return all file info.
     */
    public Map<String, String> getAllInfo() {
	return new HashMap<String, String>(this.info);
    }

    /**
     * Get file input stream.
     * 
     * @return
     */
    public InputStream getInputStream() {
	return this.fileInput;
    }

    /**
     * Set file input stream.
     * 
     * @param in
     */
    public void setInputStream(InputStream in) {
	this.fileInput = in;
    }

}
